import { defHttp } from '/@/utils/http/axios';
import { MenuModel, SimplePermissionModel } from './model/permission';
import { Ids } from '/@/model/Id';

enum Api {
  Tree = '/permission/tree',
  MenuTree = '/permission/menu/tree',
  GetMenuByIds = '/permission/menu/findByIds',
}
/**
 * @description: 查询权限数据
 */
export const getPermissionTree = () => {
  return defHttp.get<SimplePermissionModel[]>({ url: Api.Tree });
};

export const getMenuTree = () => {
  return defHttp.get<SimplePermissionModel[]>({ url: Api.MenuTree });
};

export const getMenuByIds = (params: Ids) => {
  return defHttp.post<MenuModel[]>({ url: Api.GetMenuByIds, params });
};
